package com.zkthink.ceres.promotion.dao;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zkthink.base.mapper.SuperMapper;
import com.zkthink.ceres.promotion.dto.PromotionApplyInfoPageDTO;
import com.zkthink.ceres.promotion.entity.PromotionApplyInfo;
import com.zkthink.ceres.promotion.entity.TenantPromotionApplyInfo;
import com.zkthink.ceres.promotion.vo.admin.PromotionApplyInfoPageAdminVO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * Mapper 接口 营销活动申请表
 * </p>
 *
 * @author kellen
 * @date 2020-06-16
 */
@Repository
public interface PromotionApplyInfoMapper extends SuperMapper<PromotionApplyInfo> {

  /**
   * 平台端查询活动的报名信息
   */
  @SqlParser(filter = true)
  List<PromotionApplyInfo> selectListIgnoreTenant(@Param("promotionId") Long promotionId,
      @Param("auditStatus") int auditStatus);

  /**
   * 查询需要退保证金的活动报名商家
   */
  List<TenantPromotionApplyInfo> selectListForRefundDepositWithTenant(List<Long> needSecurityList);

  /**
   * 根据活动id查询参与店铺
   */
  @SqlParser(filter = true)
  IPage<PromotionApplyInfoPageAdminVO> page(IPage<PromotionApplyInfoPageAdminVO> page,@Param("param") PromotionApplyInfoPageDTO pageDTO);

  /**
   * 查询带有商户编号的对象
   * @param id
   * @return
   */
  TenantPromotionApplyInfo selectByIdWithTenant(Long id);

  /**
   * 查询列表
   * @param promotionId
   * @param status
   * @return
   */
  List<TenantPromotionApplyInfo> selectListWithTenant(@Param("promotionId") Long promotionId, @Param("status") Integer status);

  /**
   * 平台审核所以需要过滤
   * @param id
   * @return
   */
  @SqlParser(filter = true)
  PromotionApplyInfo selectByIdIgnoreTenant(Long id);

  /**
   * 审核活动申请
   * @param info
   * @return
   */
  @SqlParser(filter = true)
  int updateByIdIgnoreTenant(PromotionApplyInfo info);
}
